import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import typescript from '@rollup/plugin-typescript';
import { terser } from 'rollup-plugin-terser';
import cleanup from 'rollup-plugin-cleanup';

export default {
  input: './src/index.ts',
  external: ['qx-util'],
  plugins: [
    resolve(),
    commonjs(),
    typescript({
      compilerOptions: {
        module: 'ESNext',
        target: 'es5',
        lib: ['DOM', 'ES2020'],
        moduleResolution: 'node',
        sourceMap: false,
        declaration: false,
        declarationMap: false,
        declarationDir: 'dist/system',
        strict: true,
        skipDefaultLibCheck: true,
        skipLibCheck: true,
        experimentalDecorators: true,
        allowSyntheticDefaultImports: true,
        downlevelIteration: true,
      },
    }),
    terser(),
    cleanup(),
  ],
  output: [
    {
      file: 'dist/ibiz-dynamic-model-api.system.min.js',
      format: 'system',
    },
    {
      file: 'dist/ibiz-dynamic-model-api.umd.js',
      name: 'DynamicModelAPI',
      format: 'umd',
    },
  ],
};
